package com.test.typeGame.core;

import java.awt.*;

public class TGScoreTarget {
    private int fontSize = 25;
    private int fontSizeStep = -1;
    private Font font = new Font("Mono", Font.PLAIN, fontSize);//TimesRoman
    private Color color = Color.green;
    private String data = "+1";
    private int x = 1;
    private int y = 1;

    private int targetX = 60;
    private int targetY = 460;
    private int stepX = 10;
    private int stepY = 10;

    public void setData(String data){
        this.data = data;
    }

    public String getData(){
        return this.data;
    }

    public Font getFont(){
        return font;
    }

    public void setColor(Color color){
        this.color = color;
    }

    public Color getColor(){
        return color;
    }

    public int getX(){
        return this.x;
    }

    public int getY(){
        return this.y;
    }

    void runToTarget(){

        if (x < targetX &&(x+stepX) >= targetX){
            x = targetX;
        }else if(x > targetX &&(x+stepX) <= targetX){
            x = targetX;
        }else{
            x += stepX;
        }

        if (y < targetY && (y+stepY) >= targetY){
            y = targetY;
        }else if (y > targetY && (y+stepY) <= targetY){
            y = targetY;
        }else {
            y += stepY;
        }

        if(fontSize > 0) {
            fontSize += fontSizeStep;
        }
        font = new Font("Mono", Font.PLAIN, fontSize);
    }

    //在目标坐标则返回true，否则返回false
    boolean isOnTarget(){
        if (x == targetX && y == targetY){
            return true;
        }else{
            return false;
        }
    }

    void setFontSize(int fontSize){
        this.fontSize = fontSize;
    }

    int getFontSize(){
        return this.fontSize;
    }

    void setFontSizeStep(int fontSizeStep){
        this.fontSizeStep = fontSizeStep;
    }

    int getFontSizeStep(){
        return this.fontSizeStep;
    }

    void setXY(int x, int y){
        this.x = x;
        this.y = y;
    }

    void setStepX(int stepX){
        this.stepX = stepX;
    }

    void setStepY(int stepY){
        this.stepY = stepY;
    }

    void setStepXY(int stepX, int stepY){
        this.stepX = stepX;
        this.stepY = stepY;
    }

    void setTargetX(int targetX){
        this.targetX = targetX;
    }

    void setTargetY(int targetY){
        this.targetY = targetY;
    }

    void setTargetXY(int targetX, int targetY){
        this.targetX = targetX;
        this.targetY = targetY;
    }

}
